<!-- Data Tables -->
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>{:lang('Delivery increases the transaction value')}</h5>
                </div>
                <div class="ibox-content">

                    <form class="form-horizontal m-t" enctype="multipart/form-data" action="{:url('purse/delivery')}" onsubmit="return sumbit_sure()" method="post">

                        <div class="form-group">
                            <label class="col-sm-3 control-label">{:lang('delivery certificate')}：</label>
                            <div class="col-sm-8">
                                <input type="file" class="btn form-control" name="file_input"  id="file_input"  accept="image/*" />
                                <div id="rrr">

                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-3">
                                <button class="btn btn-primary" type="submit" >{:lang('Submit')}</button>
                            </div>
                        </div>

                        
                    </form>
                </div>
                <div class="ibox-content">
                    
                        <table id="table" data-toggle="gridview" class="table" data-url="{:url('admin/purse/delivery_list')}" data-toolbar="#toolbar" data-show-columns="true" data-page-size="20" data-page-list="[10, 25, 50, All]" data-unique-id="id" data-pagination="true" data-side-pagination="client" data-search="true" data-click-to-select="false">
                        <thead>
                            <tr>
                                <th data-width="50" data-field="img_src" >{:lang('delivery certificate')}</th>
                                <th data-width="50" data-field="dt" >{:lang('Date')}</th>
                                <th data-width="50" data-field="status" >{:lang('status')}</th>
                                <th data-width="80" data-field="num" data-align="center">{:lang('Number')}</th>
                                <th data-width="80" data-field="money" data-align="center">{:lang('money')}</th>
                            </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">

    function operateFormatter(value, row, index) {
        return [
            '<a class="btn btn-xs edit" href="javascript:void(0)" title="{$Think.lang.Edit}">',
            '<i class="fa fa-edit"></i>',
            '</a>  ',
            '<a class="btn btn-xs delete" href="javascript:void(0)" title="{$Think.lang.Delete}">',
            '<i class="fa fa-trash"></i>',
            '</a>'
        ].join('');
    }

    var operateEvents = {
        'click .edit': function (e, value, row, index) {
            var param = {
                url: "{:url('admin/user/edit');}",
                data: {id: row.id}
            }
            $("#table").gridView('loadModal', param.url,param.data)
        },
        'click .delete': function (e, value, row, index) {
            $("#table").gridView('deleteModal', 'delete', row)
            
        }
    };
</script>
<script type="text/javascript">

    function sumbit_sure(){
        
        if(confirm("{:lang('Please confirm whether the value-added scheme is implemented or not.')}")){
            return true;
        }
        return false;
    } 
</script>
<script type="text/javascript">
    var aaa = document.getElementById("rrr");
    var input = document.getElementById("file_input");


    if(typeof FileReader==='undefined'){
        aaa.innerHTML = "No FileReader";
        input.setAttribute('disabled','disabled');
    }else{
        input.addEventListener('change',readFile,false);
    }


    function readFile(){
        var file = this.files[0];

        if(!/image\/\w+/.test(file.type)){

            return false;
        }

        var reader = new FileReader();
        reader.readAsDataURL(file);
        reader.onload = function(e){
            aaa.innerHTML = '<img height="200" width="150" src="'+this.result+'" alt=""/>'
        }
    }
</script>
